package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/shop")
public class ShoppingStatusController {
    public static final String KEY = "SHOP_STATUS";
    @Autowired
    private RedisUtil redisUtil;
    @GetMapping("/status")
    public Result getStatus() {
        Integer ans= (Integer) redisUtil.get(KEY);
        return Result.success(ans);
    }
    @PutMapping("/{status}")
    public Result setStatus(@PathVariable Integer status) {
        redisUtil.set(KEY,status);
        return Result.success();
    }
}
